﻿// =================================================================
//  Copyright (c) "David R. Guindo", Software architect
//  
//  This code is released under the terms of the Apache License, Version 2.0,
//  http://www.apache.org/licenses/LICENSE-2.0
//  
//  THIS CODE AND INFORMATION ARE PROVIDED WITHOUT WARRANTIES,
//  WITHOUT LIMITING COMMERCIAL OR PARTICULAR USE.
// =================================================================

namespace ScreenManager.Configuration
{
   using System;
   using System.Configuration;
   using System.Windows;

   //<ScreenGroup Group="Group1" Screen="Main" OnNoScreenAvailable="None" />
   public class SMWindow : ConfigurationElement
   {
      [ConfigurationProperty("containerViews", IsDefaultCollection = false, IsRequired = true)]
      [ConfigurationCollection(typeof(ContainerViewCollection), AddItemName = "containerView", ClearItemsName = "clear",
         RemoveItemName = "remove")]
      public ContainerViewCollection ContainerViews
      {
         get
         {
            return this["containerViews"] as ContainerViewCollection;
         }
      }

      [ConfigurationProperty("name", DefaultValue = "All", IsRequired = true, IsKey = true)]
      [StringValidator(MinLength = 1)]
      public String Name
      {
         get
         {
            return (String)this["name"];
         }
         set
         {
            this["name"] = value;
         }
      }

      [ConfigurationProperty("onNoScreenAvailable", DefaultValue = "Main", IsRequired = false)]
      public String OnNoScreenAvailable
      {
         get
         {
            return (String)this["onNoScreenAvailable"];
         }
         set
         {
            this["onNoScreenAvailable"] = value;
         }
      }

      [ConfigurationProperty("screen", DefaultValue = "Main", IsRequired = true)]
      [StringValidator(MinLength = 1, MaxLength = 4)]
      public String Screen
      {
         get
         {
            return (String)this["screen"];
         }
         set
         {
            this["screen"] = value;
         }
      }

      [ConfigurationProperty("type", DefaultValue = "System.Windows.Window,System.Windows", IsRequired = true)]
      public String Type
      {
         get
         {
            return (String)this["type"];
         }
         set
         {
            this["type"] = value;
         }
      }

      [ConfigurationProperty("windowState", DefaultValue = WindowState.Maximized, IsRequired = false)]
      public WindowState WindowState
      {
         get
         {
            return (WindowState)this["windowState"];
         }
         set
         {
            this["windowState"] = value;
         }
      }
   }
}